import { resSearchInfo } from "@/api";
//search模块的小仓库
const state = {
    searchInfo: {}
};
const actions = {
    async searchInfo({ commit }, params) {
        let res = await resSearchInfo(params);
        if (res.code == 200) {
            commit('SEARCHINFO', res.data)
        }
    }
};
const mutations = {
    SEARCHINFO(state, searchInfo) {
        state.searchInfo = searchInfo
    }
};
const getters = {
    attrsList(state) {
        return state.searchInfo.attrsList || []
    },
    goodsList(state) {
        return state.searchInfo.goodsList || []
    },
    trademarkList(state) {
        return state.searchInfo.trademarkList || []
    },
    total(state) {
        return state.searchInfo.total || undefined
    },
    totalPages(state) {
        return state.searchInfo.totalPages || undefined
    }
};

export default {
    state,
    mutations,
    actions,
    getters
}